<template>
	<view class="webview-content">
		<web-view src="https://twww.tsex.com/kline.html" @message="getMessage"></web-view>
	</view>
</template>

<script>
	var wv;
	export default {
		data() {
			return {
			}
		},
		onLoad(option) {
			let scHeight = uni.getSystemInfoSync().screenHeight;
			let kHeight = 425;
			if(scHeight < 680) {
				this.areaHeight = 425;
			}else{
				this.areaHeight = 460;
				kHeight = 460;
			}
			// console.log('height', scHeight)
			this.screenHeight = uni.getSystemInfoSync().screenHeight;
		
			// wv = plus.webview.create("","custom-webview",{
			// 		plusrequire:"none",
			// 		'uni-app': 'none',
			// 		top: 100,
			// 		height: kHeight,
			// 		position: 'static',
			// 		scrollIndicator: 'none'
			// 		//scalable: true
			// })
			
			// wv = plus.webview.create("","custom-webview",{
			// 		plusrequire:"none",
			// 		'uni-app': 'none',
			// 		top: 0,
			// 		height: kHeight,
			// 		position: 'static',
			// 		scrollIndicator: 'none'
			// 		//scalable: true
			// })
			// https://tsex.com
			// wv.loadURL("https://tsex.com/kline.html?marketId="+this.marketId+"&symbol="+option.defaultMarket)
			// 测试环境
			// wv.loadURL("http://47.75.209.12:18080/kline.html?marketId="+this.marketId+"&symbol="+option.defaultMarket)
			
			// https://twww.tsex.com
			// 新的测试环境
			// wv.loadURL("https://twww.tsex.com/kline.html")
			// wv.loadURL("http://localhost:3002/kline.html?marketId="+this.marketId+"&symbol="+option.defaultMarket)
			var currentWebview = this.$mp.page.$getAppWebview();
			currentWebview.setStyle({top:80,height:300})
			// currentWebview.append(wv);
		},
		onReady() {
		        // #ifdef APP-PLUS
		        var currentWebview = this.$mp.page.$getAppWebview() //获取当前页面的webview对象
		        setTimeout(function() {
		            wv = currentWebview.children()[0]
		            wv.setStyle({top:'70%',height:'80%',width:'90%',left:'5%'})
		        }, 1000); //如果是页面初始化调用时，需要延时一下
		        // #endif
		},
		methods:{
			getMessage(e){
				uni.showModal({
					title:'监听到了'
				})
			}
		}
	}
</script>

<style>
	.webview-content{
		width: 80%;
		height: 100upx;
	}
</style>
